function harriscalc(unitchoice,sex,activity,age,weight,height){

var harris=0;
var bmr=0;

//convert from US to SI
if (!unitchoice) {
height=height*2.54;
weight=weight*0.45359237;
}

//Calculate BMR
//BMR calculation for men 	BMR = 66 + ( 13.7 x weight in kg ) + ( 5 x height in cm ) - ( 6.8 x age in years )
//for women BMR = 655 + ( 9.6 x weight in kg ) + ( 1.8 x height in cm ) - ( 4.7 x age in years )

if (sex==1){
bmr=66.473 + (13.7516*weight) + (5.0033 * height) - (6.755 * age);
}

if (sex==0){
bmr= 665.0955 + (9.5634*weight) + (1.8496 * height) - (4.6756 * age);
}


//factor in activity to daily calorie req
harris=bmr * activity;


//round values
harris=Math.round(harris);
bmr=Math.round(bmr);
weight=Math.round(weight*100)/100;
height=Math.round(height*100)/100;

return {
			 bmr:bmr,
			 harris:harris,
			 weight:weight,
			 height:height,
			 age:age
	};		 
}


var descactivity="Description of activity<br /><ul><li>Little to no exercise - Sedentary</li><li>Light exercise - 1-3 days per weeks</li><li>Moderate exercise - 3-5 days per week</li><li>Heavy exercise - 6-7 days per week</li><li>Very heavy exercise - twice per day, extra heavy workouts</li></ul>";

function ref(){
// display reference
 return "<a href='http://en.wikipedia.org/wiki/Harris-Benedict_equation'>Wikipedia: Harris Benedict Equation</a>, a method used to estimate the daily calorie requirements of an individual" +"<br />The BMR is calculated from the <a href='http://en.wikipedia.org/wiki/Basal_metabolic_rate'>original formula</a>";
}

function help() {
	return descactivity;
}
